# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-optimist
_gemname=optimist
pkgver=3.1.0
pkgrel=1
pkgdesc="A commandline option parser for Ruby that just gets out of your way"
url="https://www.manageiq.org/optimist/"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-minitest ruby-rake"
source="https://github.com/ManageIQ/optimist/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	rakefile.patch
	fix-tests.patch
	fix-minitest-compat.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache "$gemdir"/doc
}

sha512sums="
8b0403e7b166644264b297641b8a666ed3a50bbc0a1722b9a46ca256eb45147c51ec02f1152af2030fd360828a4358c14af9afe35200ec2120764691412dc1af  ruby-optimist-3.1.0.tar.gz
93ab60196d4d938c02f066f6eae0367548bfc4e0d03d16af7cff542eed31d37260a34a8a677abb94389200d4c2614d2a765568181a981ff96daea87d4b8f4678  gemspec.patch
10e948fec1e26c5e8d62ae54ab8e90ed3990b2002db16007b6968daee49ad6465bb903a10b4c1b792912aeb471aba6af76f7dae592ad240e6ece0f06dad79585  rakefile.patch
adcbf8870ef30acc3e5b26553fe954428349592c389da15eebe657d6c80e873ab52acc8106384eb8d866a1890853b002a905af5f58feeff4f03f67da87fd59d6  fix-tests.patch
5267433e9cce9320adba4bf85ef903a17529dfe2e7933264b44a95a1d65ebb26b003e71009412ac2ed1021c330129572f5820a36da6913ab179a069897acd453  fix-minitest-compat.patch
"
